package com.blate.dogxiao.tools;

import android.content.Context;
import android.content.SharedPreferences;

/**
 * @author Blate
 * Created in 2021/4/22
 */
public class UserTools {

    private static final String SP_NAME = "user";

    private static final String KEY_LOGIN_STATUS = "key_login_status";

    public static boolean getLoginStatus(Context context) {
        SharedPreferences sharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
        return sharedPreferences.getBoolean(KEY_LOGIN_STATUS, false);
    }

    public static void setLoginStatus(Context context, boolean isLogin) {
        SharedPreferences sharedPreferences = context.getSharedPreferences(SP_NAME, Context.MODE_PRIVATE);
        SharedPreferences.Editor editor = sharedPreferences.edit();
        editor.putBoolean(KEY_LOGIN_STATUS, isLogin);
        editor.apply();
    }

}
